HatchShape AddRectangle
Adds a Rectangle boundary to the HatchShape
Overloads
| public void AddRectangle(float x, float y, float width, float height, float angle, float elevation) |
Return value
| void |
Parameters
| float | x | The x coordinate of the reference point of the rectangle |
| float | y | The y coordinate of the reference point of the rectangle |
| float | width | The width of the rectangle |
| float | height | The height of the rectangle |
| float | angle | The angle(radians) of rotation from the X direction in CCW, around the reference point. |
| float | elevation | The z coordinate of the reference point of the rectangle |
Example
Copy
scanDocument = scanDeviceManager.CreateScanDocument(GetselectedDeviceUniqueName(), DistanceUnit.Millimeters, false);
if (scanDocument != null)
{
VectorImage vectorImage = scanDocument.CreateVectorImage("image1", DistanceUnit.Millimeters);
vectorImage.SetMarkSpeed(1000);
vectorImage.SetJumpSpeed(2000);
vectorImage.SetJumpDelay(100);
vectorImage.SetMarkDelay(100);
//Set Laser Delays
vectorImage.SetLaserOnDelay(10);
vectorImage.SetLaserOffDelay(10);
HatchShape hatchShape = new HatchShape();
hatchShape.AddRectangle(0, 0, 50, 50, 0, 0);
hatchShape.AddLine(25, 0, 0, 25, 50, 0);
hatchShape.AddLine(30, 0, 0, 30, 50, 0);
hatchShape.AddHatchPatternLine(0, HatchLineBorderGapDirection.Inward, 0.254f,
0, 0, 0, HatchLineStyle.Unidirectional, true,
HatchOffsetAlgorithm.DirectOffset, HatchCornerStyle.Sharp);
vectorImage.AddHatch(hatchShape,0);
scanDocument.Scripts.Add(new ScanningScriptChunk("defaultScript", "ScanAll()"));
try
{
scanDocument.StartScanning();
}
catch (Exception exp)
{
MessageBox.Show(exp.Message);
}